using System;
using Oracle.ManagedDataAccess.Client;
using OracleInternal.Common;

namespace OracleInternal.NotificationServices
{
	internal class Publisher
	{
		private string component;

		private ONS oems;

		private object lock_Renamed;

		private int eventId;

		private int id_Renamed_Field;

		private string idString;

		public Publisher(ONS o, string c)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097408, OracleTraceClassName.Publisher, OracleTraceFuncName.ctor);
			}
			try
			{
				oems = o;
				realStartup(c);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)270532608, OracleTraceClassName.Publisher, OracleTraceFuncName.ctor, ex);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097664, OracleTraceClassName.Publisher, OracleTraceFuncName.ctor);
				}
			}
		}

		private void realStartup(string c)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097408, OracleTraceClassName.Publisher, OracleTraceFuncName.realStartup);
			}
			try
			{
				lock_Renamed = new object();
				component = c;
				eventId = 1;
				oems.addPublisher(this);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)270532608, OracleTraceClassName.Publisher, OracleTraceFuncName.realStartup, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097664, OracleTraceClassName.Publisher, OracleTraceFuncName.realStartup);
				}
			}
		}

		public virtual void close()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097408, OracleTraceClassName.Publisher, OracleTraceFuncName.close);
			}
			try
			{
				oems.removePublisher(this);
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)270532608, OracleTraceClassName.Publisher, OracleTraceFuncName.close, ex);
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097664, OracleTraceClassName.Publisher, OracleTraceFuncName.close);
				}
			}
		}

		protected internal virtual void id(int i)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097408, OracleTraceClassName.Publisher, OracleTraceFuncName.id);
			}
			id_Renamed_Field = i;
			string str = oems.processId();
			int num = i;
			idString = str + num;
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097664, OracleTraceClassName.Publisher, OracleTraceFuncName.id);
			}
		}
	}
}
